﻿using CacheAOP_AspectCore.AOPCache;

namespace CacheAOP_AspectCore.Service
{
    public interface IDateTimeService: ICaching
    {
        /// <summary>
        /// 在接口上加入缓存特性
        /// </summary>
        /// <returns></returns>
        [RedisCache(CacheKey = "timeInterface", Expiration = 10)]
        string GetCurrentTime();
    }

    public class DateTimeService : IDateTimeService
    {
        public string GetCurrentTime()
        {
            return System.DateTime.Now.ToString();
        }
    }
}
